<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div id="box"></div>
		<script>
			
			console.log($("#box"));//函数默认返回undefind return obj对象，进行链式调用
			
			
			$("#box").css('height','300px').css('background','red').html('hello word')
			function $(options){
				var type = typeof options;
				if (type.toLowerCase()=="function") {
					options();
				} else if(type.toLowerCase()=="string"){
					var query = options.substring(1);//将   #box 取 box；
					var el = document.getElementById(query);
				}
				
				var obj ={
					css:function(attr,val){
						el.style[attr] = val;
						return obj;
					},
					html:function(val){
						el.innerHTML = val;
					}
				}
				
				return obj;
			}
		</script>
	</body>
</html>
